import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";
type Result = {
  success: any;
  status: number;
  msg: string;
  data: {
    totalCount: number;
    items: [
      {
        taskName: string;
        score: number;
        result: number;
        status: number;
        taskStateId: number;
        id: string;
      }
    ];
  };
};
export type TreeListData = [
  {
    state?: number;
    childrens?: [TreeListData];
    id: string;
    taskId: string;
    menuId: string;
    planId: string;
    userId: string;
    taskType?: number;
    parentId: string;
    dataProcessLevelResId?: string;
    dataProcessLevelResType?: number;
    urlAddress?: string;
    titleTag?: string;
    contentTag?: string;
    ttileTagBeginStr?: string;
    ttileTagEndStr?: string;
    contentTagBeginStr?: string;
    contentTagEndStr?: string;
    resName: string;
    groupType?: number;
    fileResType?: number;
    dataType?: number;
    dataProcessTaskId?: string;
    classId?: string
  }
];
export type Tree = {
  status: 200;
  msg: "获取数据采集任务成功!";
  data: TreeListData;
  success: true;
};

//开启任务 -- 抛弃

export const GetUpdateStartTask = (params: string) => {
  return http.request<Result>(
    "post",
    baseUrlApi("/BigDataProcess/UpdateStartTask?" + params)
  );
};

//获取大数据处理任务列表
export const getBigDataProcessApi = (data: object) => {
  return http.request<Result>(
    "post",
    baseUrlApi("/BigDataProcess/GetStudentTask"),
    {
      data
    }
  );
};

//获取大数据处理路由菜单
export const GetMenuBy = (params: string) => {
  return http.request<Result>(
    "get",
    baseUrlApi("/Menu/GetMenuByMoudleId?" + params)
  );
};

//获取大数据采集树形数据
export const DataProcessGetTrees = (data: object) => {
  return http.request<Tree>("post", baseUrlApi("/DataProcessTask/GetTrees?"), {
    data
  });
};

//保存树形结构
export const DataProcessTaskCreate = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataProcessTask/Create"), {
    data
  });
};

//获取任务设置下拉选择数据

export const GetchildrenTrees = () => {
  return http.request<any>(
    "get",
    baseUrlApi("/DataProcessFolder/GetchildrenTrees")
  );
};

//大数据任务设置
export const DataSetUpTask = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataProcessTask/SetUpTask"), {
    data
  });
};

//获取采集数据列表
export const GetAllByPagedAndSort = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataProcessTask/GetAllByPagedAndSort"),
    {
      data
    }
  );
};

//完成采集数据
export const GetDataProcessTask = (parmas: string) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataProcessTask/Finish?" + parmas)
  );
};

//获取实时数据
export const GetRealtime = (parmas: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/DataProcessTask/PreviewData?" + parmas)
  );
};

//获取数据预处理树形数据
export const GetChildrenThrees = (data: object) => {
  return http.request<Tree>(
    "post",
    baseUrlApi("/DataPreprocessGroup/GetChildrenThrees"),
    { data }
  );
};

//新增数据预处理树形任务列表任务
export const GetCreate = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/Create"), {
    data
  });
};

//获取数据预处理任务设计下拉树形数据
export const GetFinishDataProcessTask = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataProcessTask/GetFinishDataProcessTask"),
    { data }
  );
};

//设置大数据预处理任务
export const GetSetUpDataPreprocess = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataPreprocessGroup/SetUpDataPreprocess"),
    { data }
  );
};

//大数据预处理文字类数据预览
export const GetDataPreprocessText = (parmas: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/DataPreprocessGroup/GetDataPreprocessText?" + parmas)
  );
};

//获取文本处理详情成功
export const GetProcessingTextRules = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataPreprocessGroup/GetProcessingTextRules"),
    { data }
  );
};


//判断这个条件有没有增加过
export const CheckTextSequence = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataPreprocessGroup/CheckTextSequence"),
    { data }
  );
};
//保存多层条件
export const HnadleTextProcessing = (params: String, data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataPreprocessGroup/HnadleTextProcessing?" + params),
    { data }
  );
};

//大数据预处理编辑条件
export const GetSaveTextFilter = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataPreprocessGroup/SaveTextFilter"),
    { data }
  );
};

//大数据预处理文字类型删除最后一条过滤条件
export const GetFilterDelete = (parmas: string) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataPreprocessGroup/FilterDeleteText?" + parmas)
  );
};


//表格类删除最后一个条件
export const GetFilterDeleteTable = (parmas: string) => {
  return http.request<any>(
    "post",
    baseUrlApi("/DataPreprocessGroup/FilterDeleteTable?" + parmas)
  );
};

//大数据处理表格数据预览
export const GetYLGridData = (parmas: string) => {
  return http.request<any>("get", baseUrlApi("/DataProcessTask/YLGridData?" + parmas))
};

//表格类型保存编辑添加
export const GetSaveFilterSelectField = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/SaveFilterSelectField"), { data })
};
//大数据处理表格过滤详情
export const GetFilterInfo = (parmas: string) => {
  return http.request<any>("get", baseUrlApi("/DataPreprocessGroup/FilterInfo?" + parmas))
};
//表格类型保存编辑条件添加
export const GetSaveFilterTableFiltration = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/SaveFilterTableFiltration"), { data })
};
//表格新增排序条件
export const GetSaveFilterTableSort = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/SaveFilterTableSort"), { data })
};

//获取图表类型数据
export const GetSelectItemBySelectType = (parmas: string) => {
  return http.request<any>("get", baseUrlApi("/Common/GetSelectItemBySelectType?" + parmas))
};

//新增图表
export const GetAddEchartData = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/AddEchartData"), { data })
};

//获取指标内容
export const GetIndex = (parmas: string) => {
  return http.request<any>("get", baseUrlApi("/DataProcessFolder/GetIndex?" + parmas))
};

//获取表达式内容数据
export const GetExpressionValue = (parmas: string) => {
  return http.request<any>("get", baseUrlApi("/DataProcessFolder/GetExpressionValue?" + parmas))
};

//表格编辑新增列
export const GetSaveFilterTableNewColumn = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/SaveFilterTableNewColumn"), { data })
};


//获取文件的分析报告
export const GetDataPreprocessAnalysisByGroupId = (parmas: string) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/GetDataPreprocessAnalysisByGroupId?" + parmas))
};
//获取文件的分析报告详情
export const GetAnalysisDetailsInfo = (parmas: string) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/GetAnalysisDetailsInfo?" + parmas))
};
export const AddAnalysisReport = (data: object) => {
  return http.request<any>("post", baseUrlApi("/DataPreprocessGroup/AddAnalysisReport"), { data })
};

